using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Common;
using Common.Enum;

namespace Converters
{
	public class EnumStringExperimentStatusConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value != DependencyProperty.UnsetValue && value is EExperimentStatus)
			{
				switch ((EExperimentStatus)value)
				{
				case EExperimentStatus.NotRunning:
				case EExperimentStatus.Interrupt:
					return Utility.GetMessage("start");
				case EExperimentStatus.AbnormalInterrupt:
					return Utility.GetMessage("continue");
				case EExperimentStatus.Running:
					return Utility.GetMessage("interrupt");
				case EExperimentStatus.Completed:
					return Utility.GetMessage("completed");
				}
			}
			return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value;
		}
	}
}
